package com.example.gamestore.mapper;

import com.example.gamestore.pojo.Game;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface GameMapper {

    int add(Game game);

    List<Game> query();

    int updateGame(Game game);

    void delete(Long id);

    @Select("SELECT * FROM game WHERE name LIKE #{key}")
    List<Game> selectGamesByName(String key);

    Game selectById(Long id);
    List<Game> selectRelatedGames(@Param("id") Long id, @Param("limit") int limit);
}
